import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
      //   title: Text(widget.title),
      // ),
      body: CustomScrollView(
        physics: BouncingScrollPhysics(),
        slivers: [
          SliverAppBar(
            title: Text('我是标题'),
            pinned: true,
            // floating: true,
            // snap: true,
            // expandedHeight: 200,
            // stretch: true,
            // flexibleSpace: FlexibleSpaceBar(
            //     title: Text('我是标题'),
            //     background: FlutterLogo(),
            //     collapseMode: CollapseMode.parallax,
            //     stretchModes: [
            //       //三个都可以用上---往下拉的效果
            //       StretchMode.blurBackground,
            //       StretchMode.zoomBackground, //放大背景
            //       StretchMode.fadeTitle //渐变文字
            //     ]),
          ),
          SliverToBoxAdapter(
            child: Placeholder(),
          ),
          SliverList(
              delegate: SliverChildListDelegate([
            FlutterLogo(size: 200),
          ])),
          SliverLayoutBuilder(
            builder: (BuildContext context, constraints) {
              print(constraints);
              return SliverToBoxAdapter(
                child: FlutterLogo(
                  size: 1000,
                ),
              );
            },
          )
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
